/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.DealFieldManager;
/*    */ import com.newcrm.db.DealManager;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import javax.servlet.RequestDispatcher;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class ShowUpdateDeal extends AbstractAction
/*    */ {
/* 31 */   private static Logger logger = Logger.getLogger(ShowUpdateDeal.class
/* 32 */     .getName());
/*    */ 
/* 34 */   private int id = 0;
/*    */ 
/*    */   public ShowUpdateDeal(AbstractHttpServlet servlet) {
/* 37 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public ShowUpdateDeal(AbstractHttpServlet servlet, String id) {
/* 41 */     super(servlet);
/* 42 */     this.id = Util.str2Int(id);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 48 */     User user = super.getLoginUser(request);
/* 49 */     DealManager manager = new DealManager();
/* 50 */     Map dealInfo = manager.getDealInfo(this.id);
/* 51 */     if ((dealInfo == null) || (dealInfo.size() == 0)) {
/* 52 */       request.getRequestDispatcher("/errorpage.jsp").forward(request, 
/* 53 */         response);
/* 54 */       return;
/*    */     }
/* 56 */     String responsibleUserId = (String)dealInfo.get("ResponsibleUserId");
/*    */ 
/* 59 */     if (!user.hasViewDealRight(responsibleUserId, 
/* 59 */       super.getCompany(user.companyId))) {
/* 60 */       throw new NotFoundException();
/*    */     }
/*    */ 
/* 64 */     List extInfos = manager.getDealExtInfo(this.id);
/* 65 */     request.setAttribute("extInfos", extInfos);
/*    */ 
/* 67 */     DealFieldManager manager2 = new DealFieldManager();
/*    */     try {
/* 69 */       List fields = manager2.list(user.companyId);
/* 70 */       request.setAttribute("fields", fields);
/*    */     } catch (Exception e) {
/* 72 */       logger.warn("get company customer field info failed", e);
/*    */     }
/*    */ 
/* 75 */     request.setAttribute("dealInfo", dealInfo);
/* 76 */     request.getRequestDispatcher("/deal_modify.jsp").forward(request, 
/* 77 */       response);
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ShowUpdateDeal
 * JD-Core Version:    0.6.1
 */